<!DOCTYPE html>
<html>
<head>
<title>req_new</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css"
	href="/codebase/fonts/font_roboto/roboto.css" />
<link rel="stylesheet" type="text/css" href="/codebase/dhtmlx.css" />
<script type="text/javascript" src="/codebase/dhtmlx.js" /> 

<script>
	var myForm, myForm2,myEditor_test_guide,myEditor_req_remark;
	var customCss = {
		video_bitrate : "validate_magenta",
		video_codec : "validate_orange"
	};
	function doOnLoad() {		
		
		
		formStructure=null;
		formStructure=[
						{type:'fieldset',label:'修改密码',list:[
									{type : 'password', name:'old_pwd', label:'旧密码', required:'true',value:'',position:'label-left'},
									{type : 'password', name:'new_pwd1', label:'新密码', required:'true',value:'',position:'label-left'},
									{type : 'password', name:'new_pwd2', label:'再次输入新密码', required:'true',value:'',position:'label-left'}
						]},	
		                 
							{type:'block',list:[
									{type : 'button',name : 'save_btn',value : '保存修改'}															
								]
		                  	}	
		                 ];
		

		
      
        
		//form_container
		if (myForm2) {
			myForm2.unload();
			myForm2 = null;

		}
		myForm2 = new dhtmlXForm("form_container2",formStructure);
		//  myForm = new dhtmlXForm("myForm", formData);
	
		 
		myForm2.attachEvent("onButtonClick", function(name) {
			
				if (name == "save_btn") {
					var r_check=check_new_pwd();
					if(r_check){											
						myForm2.send("/change_pwd_save", "post", callback);
					}
				}
										
			});
						
	}

			
	function check_new_pwd(){
		var value1=myForm2.getItemValue("new_pwd1");
		var value2=myForm2.getItemValue("new_pwd2");
		if(value1==value2){
			return true;
		}else{
			alert("两次录入密码不相同，请检查重新录入");
			return false;
		}
		
	}
	
	var callback=function () {
		//alert("callback");
		
		if(arguments[1]=="true"){
			alert("修改密码成功");	
			myForm2.clear();
			//window.location.assign("/test/test_new");
		}
		else{
			alert("修改密码失败，错误信息：\n"+arguments[1]);
		}
	}
	
	
	
</script>
</head>
<body onload="doOnLoad();">
<div id="assign_req_id" name="assign_req_id" th:text="${req_id}" style="display: none;" > </div>
	<table style="padding-left: 50px;">
		<tr>
			<td>
				<div id="form_container" name="form_container" ></div>
			</td>
		</tr>
	<tr>
			<td>
				<div id="form_container2" name="form_container2"
					 ></div>
			</td>
		</tr>
	</table>
	   
</body>
</html>